.class public Lcom/niceapp/lib/tagview/TagListView;
.super Lcom/niceapp/lib/tagview/FlowLayout;
.source "TagListView.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;,
        Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;
    }
.end annotation


# instance fields
.field private mIsDeleteMode:Z

.field private mOnTagCheckedChangedListener:Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;

.field private mOnTagClickListener:Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;

.field private mTagViewBackgroundResId:I

.field private mTagViewTextColorResId:I

.field private final mTags:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 27
    invoke-direct {p0, p1}, Lcom/niceapp/lib/tagview/FlowLayout;-><init>(Landroid/content/Context;)V

    .line 17
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    .line 28
    invoke-direct {p0}, Lcom/niceapp/lib/tagview/TagListView;->init()V

    .line 29
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attributeSet"    # Landroid/util/AttributeSet;

    .prologue
    .line 32
    invoke-direct {p0, p1, p2}, Lcom/niceapp/lib/tagview/FlowLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 17
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    .line 33
    invoke-direct {p0}, Lcom/niceapp/lib/tagview/TagListView;->init()V

    .line 34
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .registers 5
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attributeSet"    # Landroid/util/AttributeSet;
    .param p3, "defStyle"    # I

    .prologue
    .line 37
    invoke-direct {p0, p1, p2, p3}, Lcom/niceapp/lib/tagview/FlowLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 17
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    .line 38
    invoke-direct {p0}, Lcom/niceapp/lib/tagview/TagListView;->init()V

    .line 39
    return-void
.end method

.method static synthetic access$000(Lcom/niceapp/lib/tagview/TagListView;)Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;
    .registers 2
    .param p0, "x0"    # Lcom/niceapp/lib/tagview/TagListView;

    .prologue
    .line 15
    iget-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mOnTagCheckedChangedListener:Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;

    return-object v0
.end method

.method private inflateTagView(Lcom/niceapp/lib/tagview/Tag;Z)V
    .registers 9
    .param p1, "tag"    # Lcom/niceapp/lib/tagview/Tag;
    .param p2, "checkEnable"    # Z

    .prologue
    const/4 v5, 0x0

    .line 112
    invoke-virtual {p0}, Lcom/niceapp/lib/tagview/TagListView;->getContext()Landroid/content/Context;

    move-result-object v2

    sget v3, Lcom/niceapp/lib/tagview/R$layout;->tag:I

    const/4 v4, 0x0

    invoke-static {v2, v3, v4}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    check-cast v1, Lcom/niceapp/lib/tagview/TagView;

    .line 113
    .local v1, "tagView":Lcom/niceapp/lib/tagview/TagView;
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getTitle()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setText(Ljava/lang/CharSequence;)V

    .line 114
    invoke-virtual {v1, p1}, Lcom/niceapp/lib/tagview/TagView;->setTag(Ljava/lang/Object;)V

    .line 115
    iget v2, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewTextColorResId:I

    if-lez v2, :cond_9b

    invoke-virtual {p0}, Lcom/niceapp/lib/tagview/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    iget v3, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewTextColorResId:I

    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getColor(I)I

    move-result v2

    :goto_26
    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setTextColor(I)V

    .line 116
    iget v2, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewBackgroundResId:I

    if-lez v2, :cond_9e

    iget v2, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewBackgroundResId:I

    :goto_2f
    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setBackgroundResource(I)V

    .line 117
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->isChecked()Z

    move-result v2

    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setChecked(Z)V

    .line 118
    invoke-virtual {v1, p2}, Lcom/niceapp/lib/tagview/TagView;->setCheckEnable(Z)V

    .line 120
    iget-boolean v2, p0, Lcom/niceapp/lib/tagview/TagListView;->mIsDeleteMode:Z

    if-eqz v2, :cond_68

    .line 121
    const/4 v2, 0x1

    const/high16 v3, 0x40a00000

    invoke-virtual {p0}, Lcom/niceapp/lib/tagview/TagListView;->getContext()Landroid/content/Context;

    move-result-object v4

    invoke-virtual {v4}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    invoke-virtual {v4}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v4

    invoke-static {v2, v3, v4}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F

    move-result v2

    float-to-int v0, v2

    .line 122
    .local v0, "dp_5":I
    invoke-virtual {v1}, Lcom/niceapp/lib/tagview/TagView;->getPaddingLeft()I

    move-result v2

    invoke-virtual {v1}, Lcom/niceapp/lib/tagview/TagView;->getPaddingTop()I

    move-result v3

    invoke-virtual {v1}, Lcom/niceapp/lib/tagview/TagView;->getPaddingBottom()I

    move-result v4

    invoke-virtual {v1, v2, v3, v0, v4}, Lcom/niceapp/lib/tagview/TagView;->setPadding(IIII)V

    .line 123
    sget v2, Lcom/niceapp/lib/tagview/R$drawable;->forum_tag_close:I

    invoke-virtual {v1, v5, v5, v2, v5}, Lcom/niceapp/lib/tagview/TagView;->setCompoundDrawablesWithIntrinsicBounds(IIII)V

    .line 126
    .end local v0    # "dp_5":I
    :cond_68
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getBackgroundResId()I

    move-result v2

    if-lez v2, :cond_75

    .line 127
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getBackgroundResId()I

    move-result v2

    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setBackgroundResource(I)V

    .line 130
    :cond_75
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getLeftDrawableResId()I

    move-result v2

    if-gtz v2, :cond_81

    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getRightDrawableResId()I

    move-result v2

    if-lez v2, :cond_8c

    .line 131
    :cond_81
    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getLeftDrawableResId()I

    move-result v2

    invoke-virtual {p1}, Lcom/niceapp/lib/tagview/Tag;->getRightDrawableResId()I

    move-result v3

    invoke-virtual {v1, v2, v5, v3, v5}, Lcom/niceapp/lib/tagview/TagView;->setCompoundDrawablesWithIntrinsicBounds(IIII)V

    .line 134
    :cond_8c
    invoke-virtual {v1, p0}, Lcom/niceapp/lib/tagview/TagView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 135
    new-instance v2, Lcom/niceapp/lib/tagview/TagListView$1;

    invoke-direct {v2, p0, p1}, Lcom/niceapp/lib/tagview/TagListView$1;-><init>(Lcom/niceapp/lib/tagview/TagListView;Lcom/niceapp/lib/tagview/Tag;)V

    invoke-virtual {v1, v2}, Lcom/niceapp/lib/tagview/TagView;->setOnCheckedChangeListener(Landroid/widget/CompoundButton$OnCheckedChangeListener;)V

    .line 145
    invoke-virtual {p0, v1}, Lcom/niceapp/lib/tagview/TagListView;->addView(Landroid/view/View;)V

    .line 146
    return-void

    .line 115
    :cond_9b
    const/high16 v2, -0x1000000

    goto :goto_26

    .line 116
    :cond_9e
    sget v2, Lcom/niceapp/lib/tagview/R$drawable;->tag_bg:I

    goto :goto_2f
.end method

.method private init()V
    .registers 1

    .prologue
    .line 43
    return-void
.end method


# virtual methods
.method public addTag(ILjava/lang/String;)V
    .registers 4
    .param p1, "tagId"    # I
    .param p2, "tagTitle"    # Ljava/lang/String;

    .prologue
    .line 58
    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, v0}, Lcom/niceapp/lib/tagview/TagListView;->addTag(ILjava/lang/String;Z)V

    .line 59
    return-void
.end method

.method public addTag(ILjava/lang/String;Z)V
    .registers 5
    .param p1, "tagId"    # I
    .param p2, "tagTitle"    # Ljava/lang/String;
    .param p3, "checkEnable"    # Z

    .prologue
    .line 62
    new-instance v0, Lcom/niceapp/lib/tagview/Tag;

    invoke-direct {v0, p1, p2}, Lcom/niceapp/lib/tagview/Tag;-><init>(ILjava/lang/String;)V

    .line 63
    .local v0, "tag":Lcom/niceapp/lib/tagview/Tag;
    invoke-virtual {p0, v0, p3}, Lcom/niceapp/lib/tagview/TagListView;->addTag(Lcom/niceapp/lib/tagview/Tag;Z)V

    .line 64
    return-void
.end method

.method public addTag(Lcom/niceapp/lib/tagview/Tag;)V
    .registers 3
    .param p1, "tag"    # Lcom/niceapp/lib/tagview/Tag;

    .prologue
    .line 67
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/niceapp/lib/tagview/TagListView;->addTag(Lcom/niceapp/lib/tagview/Tag;Z)V

    .line 68
    return-void
.end method

.method public addTag(Lcom/niceapp/lib/tagview/Tag;Z)V
    .registers 4
    .param p1, "tag"    # Lcom/niceapp/lib/tagview/Tag;
    .param p2, "checkEnable"    # Z

    .prologue
    .line 71
    iget-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 72
    invoke-direct {p0, p1, p2}, Lcom/niceapp/lib/tagview/TagListView;->inflateTagView(Lcom/niceapp/lib/tagview/Tag;Z)V

    .line 73
    return-void
.end method

.method public addTags(Ljava/util/List;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 76
    .local p1, "tags":Ljava/util/List;, "Ljava/util/List<Lcom/niceapp/lib/tagview/Tag;>;"
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/niceapp/lib/tagview/TagListView;->addTags(Ljava/util/List;Z)V

    .line 77
    return-void
.end method

.method public addTags(Ljava/util/List;Z)V
    .registers 5
    .param p2, "checkEnable"    # Z
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;Z)V"
        }
    .end annotation

    .prologue
    .line 80
    .local p1, "tags":Ljava/util/List;, "Ljava/util/List<Lcom/niceapp/lib/tagview/Tag;>;"
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_1
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_13

    .line 81
    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/niceapp/lib/tagview/Tag;

    invoke-virtual {p0, v1, p2}, Lcom/niceapp/lib/tagview/TagListView;->addTag(Lcom/niceapp/lib/tagview/Tag;Z)V

    .line 80
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    .line 83
    :cond_13
    return-void
.end method

.method public getTags()Ljava/util/List;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;"
        }
    .end annotation

    .prologue
    .line 98
    iget-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    return-object v0
.end method

.method public getViewByTag(Lcom/niceapp/lib/tagview/Tag;)Landroid/view/View;
    .registers 3
    .param p1, "tag"    # Lcom/niceapp/lib/tagview/Tag;

    .prologue
    .line 107
    invoke-virtual {p0, p1}, Lcom/niceapp/lib/tagview/TagListView;->findViewWithTag(Ljava/lang/Object;)Landroid/view/View;

    move-result-object v0

    return-object v0
.end method

.method public onClick(Landroid/view/View;)V
    .registers 4
    .param p1, "v"    # Landroid/view/View;

    .prologue
    .line 150
    instance-of v1, p1, Lcom/niceapp/lib/tagview/TagView;

    if-eqz v1, :cond_15

    .line 151
    invoke-virtual {p1}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/niceapp/lib/tagview/Tag;

    .line 152
    .local v0, "tag":Lcom/niceapp/lib/tagview/Tag;
    iget-object v1, p0, Lcom/niceapp/lib/tagview/TagListView;->mOnTagClickListener:Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;

    if-eqz v1, :cond_15

    .line 153
    iget-object v1, p0, Lcom/niceapp/lib/tagview/TagListView;->mOnTagClickListener:Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;

    check-cast p1, Lcom/niceapp/lib/tagview/TagView;

    .end local p1    # "v":Landroid/view/View;
    invoke-interface {v1, p1, v0}, Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;->onTagClick(Lcom/niceapp/lib/tagview/TagView;Lcom/niceapp/lib/tagview/Tag;)V

    .line 156
    .end local v0    # "tag":Lcom/niceapp/lib/tagview/Tag;
    :cond_15
    return-void
.end method

.method public removeTag(Lcom/niceapp/lib/tagview/Tag;)V
    .registers 3
    .param p1, "tag"    # Lcom/niceapp/lib/tagview/Tag;

    .prologue
    .line 102
    iget-object v0, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 103
    invoke-virtual {p0, p1}, Lcom/niceapp/lib/tagview/TagListView;->getViewByTag(Lcom/niceapp/lib/tagview/Tag;)Landroid/view/View;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/niceapp/lib/tagview/TagListView;->removeView(Landroid/view/View;)V

    .line 104
    return-void
.end method

.method public setDeleteMode(Z)V
    .registers 2
    .param p1, "isDeleteMode"    # Z

    .prologue
    .line 54
    iput-boolean p1, p0, Lcom/niceapp/lib/tagview/TagListView;->mIsDeleteMode:Z

    .line 55
    return-void
.end method

.method public setOnTagCheckedChangedListener(Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;)V
    .registers 2
    .param p1, "listener"    # Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;

    .prologue
    .line 171
    iput-object p1, p0, Lcom/niceapp/lib/tagview/TagListView;->mOnTagCheckedChangedListener:Lcom/niceapp/lib/tagview/TagListView$OnTagCheckedChangedListener;

    .line 172
    return-void
.end method

.method public setOnTagClickListener(Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;)V
    .registers 2
    .param p1, "listener"    # Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;

    .prologue
    .line 167
    iput-object p1, p0, Lcom/niceapp/lib/tagview/TagListView;->mOnTagClickListener:Lcom/niceapp/lib/tagview/TagListView$OnTagClickListener;

    .line 168
    return-void
.end method

.method public setTagViewBackgroundRes(I)V
    .registers 2
    .param p1, "resId"    # I

    .prologue
    .line 46
    iput p1, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewBackgroundResId:I

    .line 47
    return-void
.end method

.method public setTagViewTextColorRes(I)V
    .registers 2
    .param p1, "resId"    # I

    .prologue
    .line 50
    iput p1, p0, Lcom/niceapp/lib/tagview/TagListView;->mTagViewTextColorResId:I

    .line 51
    return-void
.end method

.method public setTags(Ljava/util/List;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<+",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 86
    .local p1, "tags":Ljava/util/List;, "Ljava/util/List<+Lcom/niceapp/lib/tagview/Tag;>;"
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/niceapp/lib/tagview/TagListView;->setTags(Ljava/util/List;Z)V

    .line 87
    return-void
.end method

.method public setTags(Ljava/util/List;Z)V
    .registers 5
    .param p2, "checkEnable"    # Z
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<+",
            "Lcom/niceapp/lib/tagview/Tag;",
            ">;Z)V"
        }
    .end annotation

    .prologue
    .line 90
    .local p1, "tags":Ljava/util/List;, "Ljava/util/List<+Lcom/niceapp/lib/tagview/Tag;>;"
    invoke-virtual {p0}, Lcom/niceapp/lib/tagview/TagListView;->removeAllViews()V

    .line 91
    iget-object v1, p0, Lcom/niceapp/lib/tagview/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->clear()V

    .line 92
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_9
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_1b

    .line 93
    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/niceapp/lib/tagview/Tag;

    invoke-virtual {p0, v1, p2}, Lcom/niceapp/lib/tagview/TagListView;->addTag(Lcom/niceapp/lib/tagview/Tag;Z)V

    .line 92
    add-int/lit8 v0, v0, 0x1

    goto :goto_9

    .line 95
    :cond_1b
    return-void
.end method
